const { writeSubmit } = require('../models/submit')

const submit = async (req, res, next) => {
    res.set('content-type', 'application/json; charset=utf-8')
    console.log(req.file)
    const {id, file_name, time_limit, memory_limit, cases, code, state} = req.body

    await writeSubmit(id, file_name, time_limit, memory_limit, cases, code, state)

    res.render('succ', {
        data: JSON.stringify({
            msg: '上传成功!'
        })
    })
}

module.exports = {
    submit
}